package com.rdgk.newtech.controller;

import com.alibaba.fastjson.JSONObject;
import com.rdgk.newtech.service.TransService;
import com.rdgk.newtech.util.CommonUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author: msun
 * @description: 翻译的Controller
 */
@RestController
@RequestMapping("/trans")
public class TransController {

	@Autowired
	private TransService transService;

	/**
	 * 翻译论文
	 */
	@RequiresPermissions("article:list")
	@GetMapping("/paper")
	public JSONObject transPaper(HttpServletRequest request) {
		return CommonUtil.successJson(transService.transPaper());
	}

	/**
	 * 翻译专利
	 */
	@RequiresPermissions("article:list")
	@GetMapping("/patent")
	public JSONObject transPatent(HttpServletRequest request) {
		return CommonUtil.successJson(transService.transPatent());
	}

	/**
	 * 翻译科技文章
	 */
	@RequiresPermissions("article:list")
	@GetMapping("/tecArticle")
	public JSONObject transTecArticle(HttpServletRequest request) {
		return CommonUtil.successJson(transService.transTecArticle());
	}

}
